import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import directive from '@/directive/index.js'

import App from './App.vue'
import router from './router'
import project from '@/directive/project/index.js'

console.log('project', project);

const app = createApp(App)

// 全局注册指令，模式一：单个注册
app.directive('focus', {
  mounted: (el) => {
    setTimeout(() => {
      // el.focus();
      el.querySelector('input').focus();
    }, 200);
  }
})

// // 全局注册指令，模式二：批量注册，直接引入js文件，通过object.keys()遍历，后directive注册
// Object.keys(project).forEach((key) => {
//   app.directive(key, project[key])
// })

// 全局注册指令，模式三：配合插件安装实现批量注册
app.use(directive, {a: '121'});

app.use(createPinia())
app.use(router)

app.mount('#app')
